package com.ttai.presenter.activity;

import android.widget.Toast;

import com.google.gson.Gson;
import com.google.gson.JsonObject;
import com.ttai.model.net.BuildTime;
import com.ttai.model.net.ResponseInfo;
import com.ttai.presenter.base.BasePresenter;
import com.ttai.ui.activity.Register;

import retrofit2.Call;

public class RegisterPresenter extends BasePresenter {
    Register register;
    public BuildTime buildTime;

    public RegisterPresenter(Register register) {
        this.register = register;
    }



    @Override
    protected void showError(String message) {
        Toast.makeText(register,message,Toast.LENGTH_SHORT).show();
    }

    @Override
    protected void parseJson(JsonObject json) {
        Toast.makeText(register,"发送成功",Toast.LENGTH_SHORT).show();
        Gson gson = new Gson();
        buildTime = gson.fromJson(json,BuildTime.class);


    }

    public void getVerifyCode(String phone,String way){
        Call<ResponseInfo> codeInfo = responseInfoApi.verifyCode(phone,way);
        codeInfo.enqueue(new CallBackAdapter());
    }
}
